/*
 *  Copyright 2005 Blandware (http://www.blandware.com)
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */
package com.blandware.atleap.webapp.form.core;

import java.util.Map;
import java.util.Collections;
import java.util.HashMap;


/**
 * <p> Form bean that handles selection of menu items to change their visibility
 * at once
 * </p>
 * <p><a href="SwitchMenuItemSetVisibilityForm.java.html"><i>View source</i></a></p>
 *
 * @author Roman Puchkovskiy <a href="mailto:roman.puchkovskiy@blandware.com">
 *         &lt;roman.puchkovskiy@blandware.com&gt;</a>
 * @version $Revision: 1.3 $ $Date: 2005/08/04 17:25:16 $
 * @struts.form name="switchMenuItemSetVisibilityForm"
 */
public class SwitchMenuItemSetVisibilityForm extends ProcessSetForm {

    /**
     * Maps menu item ID to its position
     */
    protected Map positions = Collections.synchronizedMap(new HashMap());

    /**
     * Returns a mapping from menu item IDs to positions of corresponding menu
     * items
     *
     * @return mapping from menu item IDs to positions
     */
    public Map getPositions() {
        return positions;
    }

    /**
     * Sets a mapping from menu item IDs to positions of corresponding menu
     * items
     *
     * @param positions mapping from menu item IDs to positions
     */
    public void setPositions(Map positions) {
        this.positions = positions;
    }

    /**
     * Returns position of menu item with specified ID
     *
     * @param key ID of menu item for which to get position
     * @return position
     */
    public Object getPosition(String key) {
        return positions.get(key);
    }

    /**
     * Sets position of menu item with specified ID
     *
     * @param key   ID of menu item for which to get position
     * @param value position to set
     */
    public void setPosition(String key, Object value) {
        positions.put(key, value);
    }
}
